package com.example.hj.controller;


import com.example.hj.entity.ClassInfo;
import com.example.hj.service.IClassInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author huangjian
 * @since 2019-05-30
 */
@Controller
@RequestMapping("/school/class-info")
public class ClassInfoController {
    @Autowired
    private IClassInfoService classInfoService;

    @RequestMapping(value = "/list")
    public String list(Model model) {
        System.out.println("class-info-list============= " );
        List<ClassInfo> list = classInfoService.list();
        for (ClassInfo classInfo:list) {
            System.out.println(classInfo.getCname()+"--------"+classInfo.getCid());
        }
        model.addAttribute("classinfos", list);
        return "/school/classinfo/list";
    }
}
